package com.wft.proxy;

public class Client {
    public static void main(String[] args) {
        OrderApi order = new OrderPorxy(new Order("w1", 10, "w1"));
        System.out.println("origin order ==> " + order);
        order.setOrderNum(29, "w1");
        System.out.println("after setOrderNum ==> " + order);
        order.setProductName("w2", "w2");
        System.out.println("after setProductName ==> " + order);

        System.out.println("***************************");
        DynamicProxy proxy = new DynamicProxy();
        OrderApi orderApi = proxy.getProxyInstance(new Order("x1", 10, "x1"));
        System.out.println("origin proxy order ==>" + orderApi);
        orderApi.setOrderNum(7, "x1");
        System.out.println("after setOrderNum order ==>" + orderApi);
        orderApi.setProductName("x2", "x2");
        System.out.println("after setProductName order ==>" + orderApi);


        System.out.println("测试String");
        String a = "hello";
        System.out.println(a.getClass().getName() + "@" + Integer.toHexString(a.hashCode()));
        a+= " world";
        System.out.println(a.getClass().getName() + "@" + Integer.toHexString(a.hashCode()));

        StringBuffer sb = new StringBuffer("wft");
        System.out.println(sb.getClass().getName() + "@" + Integer.toHexString(sb.hashCode()));

        sb.append("111");
        System.out.println(sb.getClass().getName() + "@" + Integer.toHexString(sb.hashCode()));
    }
}
